#include <bits/stdc++.h>

#define pb push_back
using namespace std;

typedef long long ll;

ll n;
vector<int>q1,q2;
void solve(ll x){
	if(n<2) return;
	if(n & 1) q1.pb(x),n--; else q2.pb(x),n>>=1;
	solve(x-1);
}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	scanf("%lld",&n); n++; solve(100);
	printf("%d\n",q1.size()+q2.size()+100);
	for(int i =0;i < q1.size();i++) printf("%d ",q1[i]);
	for(int i = (int)q2.size()-1;~i;i--) printf("%d ",q2[i]);
	for(int i = 1;i <= 100;i++) printf("%d ",i);puts("");
	return 0;
}

